#include <iostream>
#include <algorithm>
using namespace std;

string addStrings(string num1, string num2) {

     int i = num1.size() - 1;
     int j = num2.size() - 1;
     int carry = 0;
     string sum;

     while(i >= 0 || j >= 0 || carry) //while循环里面负值，判断为true
     {

         int val1 = i >= 0 ? num1[i] - '0' : 0;
         int val2 = j >= 0 ? num2[j] - '0' : 0;
         int result = carry + val1 + val2;
         carry = result / 10;
         sum.push_back(result % 10 + '0');
         i--;
         j--;
     }

     //reverse(sum.begin(), sum.end());
     std::string ans;
     for(int i = sum.size(); i >= 0; i--) {
           ans.push_back(sum[i]);  
     }
     return ans;
 }


int main()
{
    cout << addStrings("11","123") << endl;
    exit(0);
    while(-1) //while循环里面负值，判断为true
    {
        cout << "-1" << endl; 
    }
}
